<html>
  <head>
    <!--<script type="text/javascript" src="aes.js"></script>-->
    <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script><script type="text/javascript">


      $(document).ready( function () {
        $("#response").html("");
        
        var drop_data = {
            location : {
              latitude : 600,
              longitude : 50,
              altitude : 6543
            },
            page: 1,
	    page_size: 50  
	};

          var params =  {
          hash : "some hash value here",
          data : drop_data,
        };

        var data = JSON.stringify(params);
         $("#response").append("Before ajaxcall");
          $("#response").append("<br/>");
        $.ajax({
                    cache: false,
                    type: "json",
                    url: "listSoftware.php",
                    contentType: "application/json",
                    processData: true,
                    data: data,
                    success: function(res, textStatus, jqXHR){
			alert("SUCCESS");
		      var container = $("#response");
			 var table = $("<table>");
			 var head = $("<tr>");
			 head.append("<th>MongoId</th>");
			 head.append("<th>Name</th>");
			 head.append("<th>Barcode</th>");
			 head.append("<th>Type</th>");
			 head.append("<th>Commission Date</th>");
			 head.append("<th>Decomission Date</th>");
			 head.append("<th>Description</th>");
		 	 table.append(head);

			 for(var key in res.data.messages)
			 {
				var tr = $("<tr>");
				var message = res.data.messages[key];
				var td = $("<td>");
				td.html(message['_id']);
				tr.append(td);
					
				var td = $("<td>");
				td.html(message.name);
				tr.append(td);
					
				var td = $("<td>");
				td.html(message.barcode);
				tr.append(td);
					
				var td = $("<td>");
				td.html(message.type);
				tr.append(td);
					
				var td = $("<td>");
				td.html(message.comDate);
				tr.append(td);
					
				var td = $("<td>");
				td.html(message.decomDate);
				tr.append(td);
					
				var td = $("<td>");
				td.html(message.description);
				tr.append(td);
					
				table.append(tr);			
			 }
                         //container.append(JSON.stringify(res['data']));
			container.html(table);
                    },
                    complete: function(XMLHttpRequest, text_status) {

                    }
                  });
        });
      
    </script>
  
  </head>
  <body>
    <div id="response">
      Stuff to be replaced
    </div>
  </body>

</html>
